package 笔记.设计模式.抽象工厂模式;

/**
 * @author chenhailong
 * @ClassName: FactoryProducer
 * @Description: 工厂的静态工厂
 * @date 2021/6/29 21:18
 * @Version 1.0
 */
public class FactoryProducer {

    public static FactoryAbstract getFactory(String string) {


        if (string == null || string.isEmpty()) {
            return null;
        }

        if (string.equalsIgnoreCase("animalfactory")) {
            return new AnimalFactroy();
        } else if (string.equalsIgnoreCase("plantfactory")) {
            return new PlantFactory();
        }
        return null;
    }
}
